#include <tchar.h>
#include <windows.h>
#ifndef CCANVAS_H
#define CCANVAS_H
#include "resource.h"
#include "CHanoi.h"
#define LEFT_BASE 50
#define COLUMN_INTERVAL 300
#define COLUMN_RADIUS 5
#define LEFT_COLUMN 200
#define COLUMN_LENGTH 240
#define BASE_LINE 400
#define BASE_THICKNESS 20
#define PLATE_THICKNESS 20
#define PLATE_DISTANCE 30
#define MAX_PLATE 140
#define PLATE_DIFF 20
#define HANDLE_RADIUS 10
#define HANDLE_LENGTH 80
#define ARROW_RADIUS 20
#define ARROW_HEIGHT 40
#define MARK_TOP 430
#define MARK_SIZE 20
#define STEP_MID 500
#define STEP_TOP 20
#define STEP_SIZE 20
class CCanvas
{
public:
    CCanvas();
    ~CCanvas();
private:
    void DrawBases(HDC hdc);
    void DrawRectangularPlates(HDC hdc);
    void DrawRoundPlates(HDC hdc);
    void DrawHand(HDC hdc);
    void DrawMark(HDC hdc);
public:
    void OnPaint(HWND  hWnd, HDC hdc);
private:
    int SetLayers(int iLayers, HWND hWnd);
    void Clear(HWND hWnd);
    void Solve(HWND hWnd);
    bool MoveLeft(HWND hWnd);
    bool MoveRight(HWND hWnd);
public:
    int OnKeyUp(char cKeyCode, HWND hWnd);
    int iPlateShape;
protected:
    CHanoi hanoi;
    HBRUSH lpBrushes[14];
    HFONT m_hFont;
    int iBaseWidth, iColumnTop, iColumeDiameter, lpiPlateRadius[7];
    int iHand, iSelect;
};
#endif
